package net.bplaced.streetfighter.lib.service;

import java.util.ArrayList;
import java.util.List;

import net.bplaced.streetfighter.lib.model.Comment;
import net.bplaced.streetfighter.lib.utils.ServiceReturnPackage;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class CommentLoaderServiceImpl
        extends CommonService<Comment[]> {

    public ServiceReturnPackage<Comment[]> loadCommentsViaPOST(Integer startIndex) {

        final HttpPost httppost = new HttpPost("http://streetfighter.bplaced.net/services/CommentFetchPostService.php");

        final List<NameValuePair> parameters = new ArrayList<NameValuePair>(1);
        parameters.add(new BasicNameValuePair("startIndex", startIndex.toString()));

        return this.sendRequest(httppost, parameters, Comment[].class);
    }
}